package com.irishud.hudnavi.ar_navi;

import com.google.gson.Gson;

import java.nio.ByteBuffer;

/**
 * Created by Administrator on 2016/9/12.
 */
public class ProtoMsg {
    public String action;
    public String content;

    public ProtoMsg(){

    }
    public ProtoMsg(String act, String content){
        this.action = act;
        this.content = content;
    }

    public  String toJsonString(){
        Gson gson = new Gson();
        return gson.toJson(this);
    }

    public static ProtoMsg fromJson(String str){
        Gson gson = new Gson();
        return  gson.fromJson(str,ProtoMsg.class);
    }

    public ByteBuffer toBytes(){
        ByteBuffer byteBuffer = ByteBuffer.wrap(toJsonString().getBytes());
        return  byteBuffer;
    }
}
